def is_prime(num):
    if num < 2:
        return False
    for i in range(2, int(num ** 0.5) + 1):
        if num % i == 0:
            return False
    return True

def find_closest_prime_number(num):
    if not num.isdigit() or len(num) != 3:
        print("Wrong input")
        return
    num = int(num)
    
    while True:
        if is_prime(num):
            print(num)
            return
        num += 1

        if is_prime(num):
            print(num)
            return
        num += 1

# Ввод трех слов
words = input("Введите три слова: ").split()

# Создание числа из слов
num = ""
for word in words:
    if word == "zero":
        num += "0"
    elif word == "one":
        num += "1"
    elif word == "two":
        num += "2"
    elif word == "three":
        num += "3"
    elif word == "four":
        num += "4"
    elif word == "five":
        num += "5"
    elif word == "six":
        num += "6"
    elif word == "seven":
        num += "7"
    elif word == "eight":
        num += "8"
    elif word == "nine":
        num += "9"

find_closest_prime_number(num)

